<?php
declare (strict_types=1);

use think\facade\Route;

Route::miss(function () {
    return \think\facade\View::fetch(app()->getBasePath() . '/error/empty.html', [
        'msg' => '没有匹配到正确路由：' . request()->url(),
    ]);
});

//首页
Route::get('/', 'index/index')->middleware('verify')->ext('html');
Route::group('index', function () {
    Route::get('/index', 'index/index');
})->middleware('verify')->ext('html');

//协议
Route::get('/index/communal', 'index/index/communal')->ext('html');

//上传
Route::group('uploads', function () {
    Route::rule('/uploadImage', 'uploads/uploadImage');
})->ext('html');

//发送验证码
Route::group('userCode', function () {
    Route::post('/sendSms', 'userCode/sendSms');
})->ext('html');

//注册
Route::group('register', function () {
    Route::get('/index', 'register/index');
    Route::get('/getPlace', 'register/getPlace');
    Route::post('/save', 'register/save');
})->ext('html');

//登录
Route::group('login', function () {
    Route::get('/index', 'login/index');
    Route::post('/check', 'login/check');
    Route::rule('/forget', 'login/forget','get|post');
})->ext('html');


//个人中心
Route::group('user', function () {
    Route::get('/index', 'user/index');
    Route::get('/contact', 'user/contact');
    Route::get('/share', 'user/share');
    Route::get('/setting', 'user/setting');
    Route::get('/info', 'user/info');
    Route::get('/my_team', 'user/my_team');
    Route::get('/release', 'user/release');
    Route::get('/methodList', 'user/methodList');
    Route::get('/method/:type', 'user/method');
    Route::post('/method_save/:type', 'user/method_save');
    Route::post('/edit', 'user/edit');
    Route::post('/logout', 'user/logout');
})->middleware('verify')->ext('html');

//设置
Route::group('security', function () {
    Route::get('/mobile', 'security/mobile');
    Route::get('/password', 'security/password');
    Route::post('/save', 'security/save');
})->middleware('verify')->ext('html');

//公告
Route::group('news', function () {
    Route::get('/index', 'news/index');
    Route::get('/info', 'news/info');
    Route::get('/getList', 'news/getList');
})->middleware('verify')->ext('html');

//商品
Route::group('product', function () {
    Route::get('/index', 'product/index');
    Route::get('/search', 'product/search');
    Route::get('/details', 'product/details');
    Route::get('/getList', 'product/getList');
    Route::post('/submit', 'product/submit');
    Route::post('/emptySearch', 'product/emptySearch');
    Route::get('/getSpecPrice', 'product/getSpecPrice');
})->middleware('verify')->ext('html');

//购物车
Route::group('cart', function () {
    Route::get('/index', 'cart/index');
    Route::post('/add', 'cart/add');
    Route::post('/edit', 'cart/edit');
    Route::post('/submit', 'cart/submit');
    Route::post('/emptyCart', 'cart/emptyCart');
})->middleware('verify')->ext('html');

//分类
Route::group('classify', function () {
    Route::get('/index', 'classify/index');
    Route::get('/getList', 'classify/getList');
})->middleware('verify')->ext('html');

//订单相关
Route::group('order', function () {
    Route::get('/index', 'order/index');
    Route::get('/payment', 'order/payment');
    Route::get('/my_order', 'order/my_order');
    Route::get('/my_order_details', 'order/my_order_details');
    Route::get('/getList', 'order/getList');
    Route::get('/success', 'order/success');
    Route::post('/submit', 'order/submit');
    Route::post('/confirmPayment', 'order/confirmPayment');
    Route::post('/edit', 'order/edit');
})->middleware('verify')->ext('html');

//地址相关
Route::group('address', function () {
    Route::get('/index', 'address/index');
    Route::get('/add', 'address/add');
    Route::get('/edit', 'address/edit');
    Route::get('/getArea', 'address/getArea');
    Route::post('/save', 'address/save');
    Route::post('/delete', 'address/delete');
    Route::post('/choice', 'address/choice');
})->middleware('verify')->ext('html');

//资产 - 我的账户
Route::group('account', function () {
    Route::get('/index', 'account/index');
    Route::get('/record/:type', 'account/record');
    Route::get('/getList', 'account/getList');
    Route::post('/pay_key', 'account/pay_key');
})->middleware('verify')->ext('html');

//充值相关
Route::group('remit', function () {
    Route::get('/index', 'remit/index');
    Route::get('/record', 'remit/record');
    Route::get('/getList', 'remit/getList');
    Route::post('/save', 'remit/save');
})->middleware('verify')->ext('html');

//提现相关
Route::group('draw', function () {
    Route::get('/index', 'draw/index');
    Route::get('/mode', 'draw/mode');
    Route::get('/record', 'draw/record');
    Route::get('/getList', 'draw/getList');
    Route::post('/save', 'draw/save');
})->middleware('verify')->ext('html');

//互转相关
Route::group('transfer', function () {
    Route::get('/index', 'transfer/index');
    Route::get('/record', 'transfer/record');
    Route::get('/getList', 'transfer/getList');
    Route::get('/verify', 'transfer/verify');
    Route::post('/save', 'transfer/save');
})->middleware('verify')->ext('html');

//转换相关
Route::group('exchange', function () {
    Route::get('/index', 'exchange/index');
    Route::get('/record', 'exchange/record');
    Route::get('/getList', 'exchange/getList');
    Route::post('/save', 'exchange/save');
})->middleware('verify')->ext('html');

//意见反馈
Route::group('message', function () {
    Route::get('/index', 'message/index');
    Route::get('/record', 'message/record');
    Route::post('/save', 'message/save');
    Route::get('/getList', 'message/getList');
})->middleware('verify')->ext('html');

